const sharp = require('sharp');
const path = require('path');
const fs = require('fs-extra');

const sizes = [16, 48, 128];
const sourceIcon = path.join(__dirname, '../src/assets/icons/icon.svg');
const outputDir = path.join(__dirname, '../src/assets/icons');

async function generateIcons() {
    // 确保输出目录存在
    await fs.ensureDir(outputDir);

    // 为每个尺寸生成图标
    for (const size of sizes) {
        const outputFile = path.join(outputDir, `icon${size}.png`);
        await sharp(sourceIcon)
            .resize(size, size)
            .png()
            .toFile(outputFile);
        console.log(`Generated: icon${size}.png`);
    }
}

generateIcons().catch(console.error); 